<!DOCTYPE html>
<html lang="zh">
{include file="public/head"}
<body>
<div class="container-fluid">
  <div class="row">

    <div class="col-lg-12">
      <div class="card">
        <div class="card-body">
          <h6>包含的子订单列表</h6>
          <table class="table">
            <thead>
              <tr>
                <th scope="col">id</th>
                <th scope="col">订单号</th>
                <th scope="col">服务名称</th>
                <th scope="col">下单用户</th>
                <th scope="col">订单状态</th>
                <th scope="col">操作</th>
              </tr>
            </thead>
            <tbody>
              {volist name="list" id="v" key="k"}
              <tr>
                <th scope="row">{$v.id}</th>
                <td>{$v.order_no}</td>
                <td>{$v.service_name}</td>
                <td>{$v.username}</td>
                <td>
                    {switch $v.status}
                        {case 1}<span class="badge bg-success">进行中</span>{/case}
                        {case 2}<span class="badge bg-warning">取消</span>{/case}
                        {case 3}<span class="badge bg-danger">申请退费</span>{/case}
                        {case 4}<span class="badge bg-primary">服务完成</span>{/case}
                        {default /}<span class="badge bg-success">进行中</span>
                    {/switch}
                </td>
                <td>
                  <button type="button" class="btn btn-primary btn-sm btn-teal edit-btn" value="{$v.id}">
                    <i class="mdi mdi-checkbox-marked-circle-outline"></i> 开始
                  </button>
                  {if $v.status == 1}
                  <button type="button" class="btn btn-success btn-sm order-complete" value="{$v.id}">
                    <i class="mdi mdi-checkbox-marked-circle-outline"></i>设置此订单为已完成
                  </button>
                  {/if}
                </td>
              </tr>
              {/volist}
            </tbody>
          </table>
        </div>
      </div>
    </div>

  </div>

</div>
{include file="public/script"}
<script type="text/javascript">
$('.edit-btn').click(function(){

    var id = $(this).val();
    parent.layer.open({
        type: 2,
        title: '订单详情',
        maxmin: true,
        area: ['95%', '95%'],
        content: '/admin/expertOrder/edit?id='+id,
    });

})

$('.order-complete').click(function(){
    var id = $(this).val();
    layer.confirm('确定设置此订单为已完成吗?', function(index){
        $.post('/admin/expertOrder/setOrderComplete',{id:id},function(res)
        {
            if(res.code == 200)
            {
                showNotify(res.msg, 'success', 1000, 'mdi mdi-emoticon-happy', 'top', 'right', '{$action}');

                //$("#table").bootstrapTable('selectPage', $("#table").bootstrapTable("getOptions").pageNumber);  //跳转到此页
            }else{
                showNotify(res.msg, 'danger', 1000, 'mdi mdi-information-outline', 'top', 'right');
            }
        })
        layer.close(index);
    })
})

</script>
</body>
</html>